package com.nuoyun.tnvmue.adapter;


import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * @author JiangAdmin
 * date: 2020/4/10
 * Email: jiangmr@vip.qq.com
 * TODO: 主页适配器
 */

public class MainAdapter extends FragmentPagerAdapter {

    /**
     *  创建FragmentManager
     */
    private FragmentManager fragmetnmanager;
    /**
     *  创建一个List<Fragment>
     */
    private List<Fragment> listfragment;

    public MainAdapter(FragmentManager fm, List<Fragment> list) {
        super(fm);
        this.fragmetnmanager = fm;
        this.listfragment = list;
    }

    @NonNull
    @Override
    public Fragment getItem(int arg0) {
        //返回第几个fragment
        return listfragment.get(arg0);
    }


    @Override
    public int getCount() {
        //总共有多少个fragment
        return listfragment.size();
    }

}